var xhr = null;

function getRequest(){
	
	if(window.activeXObject){
		xhr = new ActiveXObject("Microsoft.XMLHttp");
		
	}else{
		xhr = new XMLHttpRequest();
	}
	
}

function sendRequest(url,param,callBack,method,sync){
	
	getRequest();
	
	method = (method.toLowerCase == "get" ? "GET" : "POST" );
	
	param = (param==null || param==""? null : param);
	
	if(method == "GET" ){
		
		url = url+'?'+param;
		
	}
	
	xhr.onreadystatechange=callBack;
	
	xhr.open(method, url, sync);
	
	xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	xhr.send(method == "POST" ? param : null);
	
}